It is desired to conduct a precise measurement of the ambient temperature with a portable electronic device such as a mobile phone or a portable computing device such as a tablet computer, which portable electronic device typically comprises a processor and/or a display generating heat during operation.